#!/usr/bin/python

f1=file("pctb5.sen.align.eng","r")
f11=file("pctb5.tree.align.eng","r")
f2=file("pctb5.sen.align.chi","r")
f22=file("pctb5.tree.align.chi","r")

g1=file("cttb.sen.eng","w")
g11=file("cttb.tree.eng","w")
g2=file("cttb.sen.chi","w")
g22=file("cttb.tree.chi","w")

lines1=f1.readlines()
lines11=f11.readlines()
lines2=f2.readlines()
lines22=f22.readlines()
f1.close()
f11.close()
f2.close()
f22.close()

if len(lines1) != len(lines2):
	sys.exit()
if len(lines1) != len(lines11):
	sys.exit()
if len(lines1) != len(lines22):
	sys.exit()

for i in range(len(lines1)):
	l1=len(lines1[i].strip().split())
	l2=len(lines2[i].strip().split())
	if l1>=79 or l2>=79:
		continue
	else:
		g1.write(lines1[i]);
		g2.write(lines2[i]);
		g11.write(lines11[i]);
		g22.write(lines22[i]);
g1.close()
g11.close()
g2.close()
g22.close()
